﻿<Window x:Class="AgeValidator.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="clr-namespace:AgeValidator"
        Title="MainWindow" Height="350" Width="525">
    <StackPanel>
        <TextBox x:Name="LabelAge" Width="40">
            <TextBox.Text>
                <Binding UpdateSourceTrigger="PropertyChanged">
                    <Binding.ElementName>SliderAge</Binding.ElementName>
                    <Binding.Path>Value</Binding.Path>
                    <Binding.ValidationRules>
                        <local:AgeValidation/>
                    </Binding.ValidationRules>
                </Binding>
            </TextBox.Text>
        </TextBox>
        <Slider x:Name="SliderAge" Width="100" Minimum="1" Maximum="110" IsSnapToTickEnabled="True" TickFrequency="1"/>
    </StackPanel>
</Window>
